package com.yupi.springbootinit.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * 这是一个中间表
 * @TableName middle
 */
@TableName(value ="middle")
@Data
public class Middle implements Serializable {
    /**
     * 
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 操作
     */
    @TableField(value = "operate")
    private String operate;

    /**
     * 执行语句
     */
    @TableField(value = "execute")
    private String execute;

    @TableField(value = "table_key")
    private String tableKey;

    @TableField(value = "conditions")
    private String conditions;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Middle middle = (Middle) o;
        return Objects.equals(id, middle.id) && Objects.equals(operate, middle.operate) && Objects.equals(execute, middle.execute) && Objects.equals(tableKey, middle.tableKey) && Objects.equals(conditions, middle.conditions);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, operate, execute, tableKey, conditions);
    }

    @Override
    public String toString() {
        return "Middle{" +
                "id=" + id +
                ", operate='" + operate + '\'' +
                ", execute='" + execute + '\'' +
                ", tableKey='" + tableKey + '\'' +
                ", condition='" + conditions + '\'' +
                '}';
    }
}